//
//  UIImage+HFAdd.h
//  HeFanLIVE
//
//  Created by Shelin on 16/12/13.
//
//

#import <UIKit/UIKit.h>


typedef NS_ENUM(NSUInteger, ImageCombineType) {
    ImageCombineHorizental,
    ImageCombineVertical
};

@interface UIImage (HFAdd)

/**
 *  生成圆角矩形，常用UIButton背景图
 */
+ (UIImage *)roundRectangleWithRadius:(CGFloat)radius
                                 size:(CGSize)size
                                color:(UIColor *)color;

/**
 *  生成带边框的圆角矩形，常用UIButton背景图
 */
+ (UIImage *)roundRectangleBorderWithRadius:(CGFloat)radius
                                       size:(CGSize)size
                                borderColor:(UIColor *)borderColor;

/**
 *  颜色生成图片
 */
+ (UIImage*)createImageWithColor:(UIColor*)color;

/**
 压缩图片
 @param scImg     图片
 @param limitSize 大小
 @return  压缩到指定大小
 */
+(UIImage *)cereateSizeImageWithImage:(UIImage *)scImg limitSize:(CGSize)limitSize;

/**
 data数据转image
 @param imageData 数据
 @return img
 */
+(nullable UIImage *)bg_imageWithData:(nonnull NSData *)imageData;

/**
 *  生成一张高斯模糊的图片
 *  @param image 原图
 *  @param blur  模糊程度 (0~1)
 *  @return 高斯模糊图片
 */
+ (UIImage *_Nullable)blurImage:(UIImage *_Nullable)image blur:(CGFloat)blur;

/**
 *  返回一张可以随意拉伸不变形的图片
 *  @param name 图片名字
 */
+ (UIImage *)resizableImage:(NSString *)name;

/**
 拼接图片
 @param images images description
 @param orientation orientation description
 @return return value description
 */
+(UIImage *)combineWithImages:(NSArray *)images orientation:(ImageCombineType)orientation;

/**
 局部收缩
 @param capInsets capInsets description
 @param actualSize actualSize description
 @return return value description
 */
- (UIImage *)shrinkImageWithCapInsets:(UIEdgeInsets)capInsets actualSize:(CGSize)actualSize;








#pragma mark - private ---
/**
 按照一定大小缩放图片
 @param size size description
 @return return value description
 */
-(UIImage *)scaleImageToSize:(CGSize)size;


/**
 裁剪图片
 @param clipRect clipRect description
 @return return value description
 */
-(UIImage *)clipImageWithClipRect:(CGRect)clipRect;





@end
